<?php

$placeCountry = $data['PlaceCountry'];
$placeStates = $data['PlaceState'];


?>

<h2> Edition du pays : <?php echo $placeCountry['name'];?> </h2>

<?php
    echo $this->Form->create('PlaceState');
    echo $this->Form->input('name');
    echo $this->Form->hidden('countries_id', array(
        'value' => $placeCountry['places_id']
        )
    );
    echo $this->Form->end('Add');
?>

<h2> Les Régions présentes </h2>
<?php


if (!empty($placeStates)){
    ?>
<table>
    <thead>
        <tr>
            <td>Name</td>
            <td colspan="3">Options</td>
        </tr>
    </thead>
    <tbody>
<?php
    foreach ($placeStates as $state){
        $id = $state['places_id'];
       ?>
    <tr>
        <td> <?php echo $this->Html->link($state['name'], array('controller' => 'PlaceStates', 'action' => 'admin_edit', $id));?> </td>      
        <td> <?php echo $this->Html->link('Supprimer', array('controller' => 'Places', 'action' => 'admin_del', 'id' => $id, 'controllerName' => 'PlaceCountries', 'actionName' => 'admin_edit', 'param' => $placeCountry['places_id']));?> </td>      
        <td> <?php echo $this->Html->link('Modifier', array('controller' => 'PlaceCountries', 'action' => 'admin_edit', $id));?> </td>      
    </tr>
    <?php
    }
    ?>
    </tbody>
</table>
    <?php
}
else{
    ?>
    <p>
        Aucun région n'est enregistré !
    </p>
    <?php
}

debug($data);
?>
